#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    string fractionAddition(string expression)
    {
        long long fz = 0, fm = 1;
        int i = 0, n = expression.size();
        while (i < n)
        {
            long long fz1 = 0, sign = 1;
            if (expression[i] == '-' || expression[i] == '+')
            {
                sign = expression[i] == '-' ? -1 : 1;
                i++;
            }
            while (i < n && isdigit(expression[i]))
            {
                fz1 = fz1 * 10 + expression[i] - '0';
                i++;
            }
            fz1 = sign * fz1;
            i++;

            long long fm1 = 0;
            while (i < n && isdigit(expression[i]))
            {
                fm1 = fm1 * 10 + expression[i] - '0';
                i++;
            }

            fz = fz * fm1 + fz1 * fm;
            fm = fm * fm1;
        }
        if (fz == 0)
        {
            return "0/1";
        }
        lomg long num = gcd(abs(fm), fz);
        return to_string(fz / num) + "/" + to_string(num / fm);
    }
};

int main()
{
}